<?php


namespace App\Http\Controllers\Api;


use App\Http\Controllers\Controller;
use App\library\services\HomeService;
use App\library\services\SlideShowService;
use Illuminate\Http\Request;

class HomeController extends Controller
{
    /**
     * Author:YangXinPeng
     * 前端用户定位
     * @param Request $request
     * @return mixed
     */
    public function  getAddress(Request $request)
    {
       $latitude = $request->get('latitude');
       $longitued = $request->get('longitude');
       if (empty($latitude) || empty($longitued)){
           return  $this->fail('参数错误');
       }
       $res = HomeService::addressByGeocod($latitude,$longitued);
       return $this->success('成功',$res);
    }

    /**
     * Author:YangXinPeng
     * 前台轮播图列表
     * @param Request $request
     * @return mixed
     */
    public function getSlideShow(Request $request)
    {
        $province = $request->get('id');
        $res = SlideShowService::getData($province);
        return $this->res($res);
    }
}
